﻿/*
 * TerminalFont.java
 *
 * Created on 2007年8月2日, 下午 11:42
 *
 */

package org.uranus.core.terminal;

/**
 * Copyright 2007 Hsiang-Yu Wang<br>
 * This file is distributed under the terms of the GNU General Public License<br>
 *<br>
 *<pre>
 * --------------------License notice--------------------
 * GNU GENERAL PUBLIC LICENSE
 * Version 3, 29 June 2007
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not,
 * visit: http://www.gnu.org/licenses/gpl.txt
 * --------------------License notice--------------------</pre>
 *
 * @author Hsiang-Yu Wang
 */
public class TerminalFont{
    
    private char text;
    private int bgcolor;
    private int fgcolor;
    private int type;
    private boolean padding;
    private char hiddingText;
    private boolean twoBytes = false;
    /**
     * Creates a new instance of TerminalFont
     */
    public TerminalFont() {
        setText((char)0);
        setBgcolor(0x000000);
        setFgcolor(0xFFFFFF);
        setType(0);
        setPadding(false);
    }
    
    public TerminalFont(char text){
        this.setText(text);
        setBgcolor(0x000000);
        setFgcolor(0xFFFFFF);
        setType(0);
        setPadding(false);
    }
    
    
    
    public void setText(char t) {
        if((t >> 8) > 0){
            setTwoBytes(true);
            this.text = t;
        }else{
            if(((byte)t >= 0x20 && (byte)t <= 0x7E) || (byte)t == 0x0A || (byte)t == 0x0D || (byte)t == 0x1B){
                this.text = t;
            }else{
                this.text = 0 ;
                this.hiddingText = t;
            }
        }
    }
    public char getText() {
        return text;
    }
    
    public int getBgcolor() {
        return bgcolor;
    }
    
    public void setBgcolor(int bgcolor) {
        this.bgcolor = bgcolor;
    }
    
    public int getFgcolor() {
        return fgcolor;
    }
    
    public void setFgcolor(int fgcolor) {
        this.fgcolor = fgcolor;
    }
    
    public int getType() {
        return type;
    }
    
    public void setType(int type) {
        this.type = type;
    }
    
    public char getHiddingText() {
        return hiddingText;
    }
    
    public void setHiddingText(char hiddingText) {
        this.hiddingText = hiddingText;
    }
    
    public boolean isTwoBytes() {
        return twoBytes;
    }
    
    public void setTwoBytes(boolean twoBytes) {
        this.twoBytes = twoBytes;
    }
    
    public boolean isPadding() {
        return padding;
    }
    
    public void setPadding(boolean padding) {
        this.padding = padding;
    }
    
}
